package com.suns.sharephoto.controller;

import com.suns.sharephoto.common.PageResult;
import com.suns.sharephoto.common.Result;
import com.suns.sharephoto.service.UserService;
import com.suns.sharephoto.vo.UserStatsVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {
    
    @Autowired
    private UserService userService;
    
    @GetMapping("/stats/{userId}")
    public Result<UserStatsVO> getUserStats(@PathVariable Integer userId) {
        UserStatsVO stats = userService.getUserStats(userId);
        return Result.success(stats);
    }
    
    @GetMapping("/photos/{userId}")
    public Result<PageResult> getUserPhotos(
            @PathVariable Integer userId,
            @RequestParam(defaultValue = "1") Integer page) {
        PageResult photos = userService.getUserPhotos(userId, page);
        return Result.success(photos);
    }
}
